module.exports = app => {
  const {
    STRING,
    INTEGER
  } = app.Sequelize; // 获取数据类型
  const Favorite = app.model.define('favorite', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true
    },
    cook_id: {
      type: INTEGER,
      allowNull: true
    },
    user_id: {
      type: INTEGER,
      allowNull: false
    },
    favorite_type: {
      type: INTEGER,
      allowNull: false,
      defaultValue: 1 // 1：收藏食谱  2：收藏用户
    },
    favorite_user_id: {
      type: INTEGER,
      allowNull: true
    }
  }, {
    freezeTableName: true,
    timestamps: false,
    createdAt: 'create_time',
    updatedAt: 'updated_time',
    deletedAt: false,
    paranoid: false
  })
  return Favorite
}